#region MIT Licence
/*
 * Copyright (C) 2014 PdfCreative
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 
 * and associated documentation files (the "Software"), to deal in the Software without restriction, 
 * including without limitation the rights to use, copy, modify, merge, publish, distribute, 
 * sublicense, and/or sell copies of the Software, and to permit persons to whom 
 * the Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included 
 * in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 
 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE 
 * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 
 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */
#endregion

using System;

using PdfCreative.Pdf.Writer.Utilities;

namespace PdfCreative.Pdf.Writer
{
    /// <summary>
    /// The PdfFont class encapsulates the information for a font resource that will be included in a PDF document.
    /// This is not the same as information on the font, such as its glyph metrics or classification, but just the parts that
    /// identify the font within the PDF document, and the font's type name.
    /// Clients don't need to create PdfFont instances themselves; to obtain a PdfFont reference, call one of the CreateFont()
    /// overloads on a Writer instance.
    /// </summary>
    [Serializable]
    public class PdfFont : PdfResourceReference
    {
        // Private fields
        // ==============
        #region Private fields
        private string _typename;
        bool _isEmbedded;
        FontLocation _location;
        #endregion



        // Public properties
        // =================
        #region Public properties
        /// <summary>
        /// Sets or retrieves a value that indicates if this font is to be embedded in the PDF document.
        /// </summary>
        public bool IsEmbedded
        {
            get { return _isEmbedded; }
            set { _isEmbedded = value; }
        }

        /// <summary>
        /// Sets or retrieves this font's location.
        /// </summary>
        public FontLocation Location
        {
            get { return _location; }
            set { _location = value; }
        }

        /// <summary>
        /// Retrieves the object reference for this resource.
        /// </summary>
        public override string ResourceType
        {
            get { return "Font"; }
        }

        /// <summary>
        /// Sets or retrieves the type name for this font.
        /// </summary>
        public string Typename
        {
            get { return _typename; }
            set { _typename = value; }
        }
        #endregion



        // Public constructor
        // ==================
        #region Public constructor
        /// <summary>
        /// Constructs a new PdfFont instance.
        /// </summary>
        /// <param name="font">The font object reference</param>
        /// <param name="identifier">The identifier of this resource</param>
        /// <param name="typename">The type of the font</param>
        /// <param name="embedFontFile">Should this font be embedded in the PDF document?</param>
        public PdfFont(PdfObjectReference font, string identifier, string typename, bool embedFontFile)
            : base(font, identifier)
        {
            _typename = typename;
            _isEmbedded = embedFontFile;
        }
        #endregion
    } // PdfFont class
}
